<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
   
      <title></title>
      <link rel="stylesheet" href="../reference.css" type="text/css">
      <meta name="generator" content="DocBook XSL Stylesheets V1.62.4">
   </head>
   <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
      <div class="reference" lang="en"><a name="d0e1"></a><div class="titlepage">
            <div>
               <div>
                  <h1 class="title"><a name="d0e1"></a>Common Template Reference
                  </h1>
               </div>
               <div>
                  <div class="author">
                     <h3 class="author"><span class="firstname">Norman</span> <span class="surname">Walsh</span></h3>
                  </div>
               </div>
               <div>
                  <p class="releaseinfo">
                     $Id: common.xsl,v 1.39 2003/12/06 00:07:51 bobstayton Exp $
                     
                  </p>
               </div>
               <div>
                  <p class="copyright"><a href="../copyright.html"></a> &copy; 19992000  Norman Walsh. <a href="../warranty.html">No Warranty</a>.
                  </p>
               </div>
            </div>
            <div></div>
            <hr>
         </div>
         <div class="partintro" lang="en">
            <div>
               <div></div>
               <div></div>
            </div>
            <div class="section" lang="en">
               <div class="titlepage">
                  <div>
                     <div>
                        <h2 class="title" style="clear: both"><a name="d0e24"></a></h2>
                     </div>
                  </div>
                  <div></div>
               </div>
               <p>This is technical reference documentation for the DocBook XSL
                  Stylesheets; it documents (some of) the parameters, templates, and
                  other elements of the stylesheets.
               </p>
               <p>This is not intended to be <span class="quote">user</span> documentation.
                  It is provided for developers writing customization layers for the
                  stylesheets, and for anyone who's interested in <span class="quote">how it
                     works</span>.
               </p>
               <p>Although I am trying to be thorough, this documentation is known
                  to be incomplete. Don't forget to read the source, too :-)
               </p>
            </div>
            <div class="toc">
               <p><b></b></p>
               <dl>
                  <dt><a href="#template.is.component">is.component</a> - Tests if a given node is a component-level element
                  </dt>
                  <dt><a href="#template.is.section">is.section</a> - Tests if a given node is a section-level element
                  </dt>
                  <dt><a href="#template.section.level">section.level</a> - Returns the hierarchical level of a section.
                  </dt>
                  <dt><a href="#template.qanda.section.level">qanda.section.level</a> - Returns the hierarchical level of a QandASet.
                  </dt>
                  <dt><a href="#template.select.mediaobject">select.mediaobject</a> - Selects and processes an appropriate media object from a list
                  </dt>
                  <dt><a href="#template.select.mediaobject.index">select.mediaobject.index</a> - Selects the position of the appropriate media object from a list
                  </dt>
                  <dt><a href="#template.is.acceptable.mediaobject">is.acceptable.mediaobject</a> - Returns '1' if the specified media object is recognized.
                  </dt>
                  <dt><a href="#template.check.id.unique">check.id.unique</a> - Warn users about references to non-unique IDs
                  </dt>
                  <dt><a href="#template.check.idref.targets">check.idref.targets</a> - Warn users about incorrectly typed references
                  </dt>
                  <dt><a href="#template.copyright.years">copyright.years</a> - Print a set of years with collapsed ranges
                  </dt>
                  <dt><a href="#template.find.path.params">find.path.params</a> - Search in a table for the "best" match for the node
                  </dt>
               </dl>
            </div>
         </div>
         <div class="refentry" lang="en"><a name="template.is.component"></a><div class="titlepage">
               <div></div>
               <div></div>
            </div>
            <div class="refnamediv">
               <h2></h2>
               <p>is.component &#8212; Tests if a given node is a component-level element</p>
            </div>
            <div class="refsynopsisdiv">
               <h2></h2><pre class="synopsis">&lt;xsl:template name="is.component"&gt;
&lt;xsl:param name="node" select="."/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
            <div class="refdescription"><a name="d0e48"></a>
               
               
               <p>This template returns '1' if the specified node is a component
                  (Chapter, Appendix, etc.), and '0' otherwise.
               </p>
               
               
            </div>
            <div class="refparameter"><b><a name="d0e53"></a>Parameters</b>
               
               
               <div class="variablelist">
                  <dl>
                     <dt><span class="term">node</span></dt>
                     <dd>
                        <p>The node which is to be tested.</p>
                     </dd>
                  </dl>
               </div>
               
               
            </div>
            <div class="refreturn"><b><a name="d0e63"></a>Returns</b>
               
               
               <p>This template returns '1' if the specified node is a component
                  (Chapter, Appendix, etc.), and '0' otherwise.
               </p>
               
               
            </div>
         </div>
         <div class="refentry" lang="en">
            <div class="refentry.separator">
               <hr>
            </div><a name="template.is.section"></a><div class="titlepage">
               <div></div>
               <div></div>
            </div>
            <div class="refnamediv">
               <h2></h2>
               <p>is.section &#8212; Tests if a given node is a section-level element</p>
            </div>
            <div class="refsynopsisdiv">
               <h2></h2><pre class="synopsis">&lt;xsl:template name="is.section"&gt;
&lt;xsl:param name="node" select="."/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
            <div class="refdescription"><a name="d0e77"></a>
               
               
               <p>This template returns '1' if the specified node is a section
                  (Section, Sect1, Sect2, etc.), and '0' otherwise.
               </p>
               
               
            </div>
            <div class="refparameter"><b><a name="d0e82"></a>Parameters</b>
               
               
               <div class="variablelist">
                  <dl>
                     <dt><span class="term">node</span></dt>
                     <dd>
                        <p>The node which is to be tested.</p>
                     </dd>
                  </dl>
               </div>
               
               
            </div>
            <div class="refreturn"><b><a name="d0e92"></a>Returns</b>
               
               
               <p>This template returns '1' if the specified node is a section
                  (Section, Sect1, Sect2, etc.), and '0' otherwise.
               </p>
               
               
            </div>
         </div>
         <div class="refentry" lang="en">
            <div class="refentry.separator">
               <hr>
            </div><a name="template.section.level"></a><div class="titlepage">
               <div></div>
               <div></div>
            </div>
            <div class="refnamediv">
               <h2></h2>
               <p>section.level &#8212; Returns the hierarchical level of a section.</p>
            </div>
            <div class="refsynopsisdiv">
               <h2></h2><pre class="synopsis">&lt;xsl:template name="section.level"&gt;
&lt;xsl:param name="node" select="."/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
            <div class="refdescription"><a name="d0e106"></a>
               
               
               <p>This template calculates the hierarchical level of a section.
                  The element <tt class="sgmltag-element">sect1</tt> is at level 1, <tt class="sgmltag-element">sect2</tt> is
                  at level 2, etc.
               </p>
               
               
               
               
               <p>Recursive sections are calculated down to the fifth level.</p>
               
               
            </div>
            <div class="refparameter"><b><a name="d0e120"></a>Parameters</b>
               
               
               <div class="variablelist">
                  <dl>
                     <dt><span class="term">node</span></dt>
                     <dd>
                        <p>The section node for which the level should be calculated.
                           Defaults to the context node.
                        </p>
                     </dd>
                  </dl>
               </div>
               
               
            </div>
            <div class="refreturn"><b><a name="d0e130"></a>Returns</b>
               
               
               <p>The section level, <span class="quote">1</span>, <span class="quote">2</span>, etc.
                  
               </p>
               
               
            </div>
         </div>
         <div class="refentry" lang="en">
            <div class="refentry.separator">
               <hr>
            </div><a name="template.qanda.section.level"></a><div class="titlepage">
               <div></div>
               <div></div>
            </div>
            <div class="refnamediv">
               <h2></h2>
               <p>qanda.section.level &#8212; Returns the hierarchical level of a QandASet.</p>
            </div>
            <div class="refsynopsisdiv">
               <h2></h2><pre class="synopsis">&lt;xsl:template name="qanda.section.level"/&gt;</pre></div>
            <div class="refdescription"><a name="d0e150"></a>
               
               
               <p>This template calculates the hierarchical level of a QandASet.
                  
               </p>
               
               
            </div>
            <div class="refreturn"><b><a name="d0e155"></a>Returns</b>
               
               
               <p>The level, <span class="quote">1</span>, <span class="quote">2</span>, etc.
                  
               </p>
               
               
            </div>
         </div>
         <div class="refentry" lang="en">
            <div class="refentry.separator">
               <hr>
            </div><a name="template.select.mediaobject"></a><div class="titlepage">
               <div></div>
               <div></div>
            </div>
            <div class="refnamediv">
               <h2></h2>
               <p>select.mediaobject &#8212; Selects and processes an appropriate media object from a list</p>
            </div>
            <div class="refsynopsisdiv">
               <h2></h2><pre class="synopsis">&lt;xsl:template name="select.mediaobject"&gt;
&lt;xsl:param name="olist" select="imageobject|imageobjectco                      |videoobject|audioobject|textobject"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
            <div class="refdescription"><a name="d0e175"></a>
               
               
               <p>This template takes a list of media objects (usually the
                  children of a mediaobject or inlinemediaobject) and processes
                  the "right" object.
               </p>
               
               
               
               
               <p>This template relies on a template named 
                  "select.mediaobject.index" to determine which object
                  in the list is appropriate.
               </p>
               
               
               
               
               <p>If no acceptable object is located, nothing happens.</p>
               
               
            </div>
            <div class="refparameter"><b><a name="d0e186"></a>Parameters</b>
               
               
               <div class="variablelist">
                  <dl>
                     <dt><span class="term">olist</span></dt>
                     <dd>
                        <p>The node list of potential objects to examine.</p>
                     </dd>
                  </dl>
               </div>
               
               
            </div>
            <div class="refreturn"><b><a name="d0e196"></a>Returns</b>
               
               
               <p>Calls &lt;xsl:apply-templates&gt; on the selected object.</p>
               
               
            </div>
         </div>
         <div class="refentry" lang="en">
            <div class="refentry.separator">
               <hr>
            </div><a name="template.select.mediaobject.index"></a><div class="titlepage">
               <div></div>
               <div></div>
            </div>
            <div class="refnamediv">
               <h2></h2>
               <p>select.mediaobject.index &#8212; Selects the position of the appropriate media object from a list</p>
            </div>
            <div class="refsynopsisdiv">
               <h2></h2><pre class="synopsis">&lt;xsl:template name="select.mediaobject.index"&gt;
&lt;xsl:param name="olist" select="imageobject|imageobjectco                      |videoobject|audioobject|textobject"/&gt;
&lt;xsl:param name="count"&gt;1&lt;/xsl:param&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
            <div class="refdescription"><a name="d0e210"></a>
               
               
               <p>This template takes a list of media objects (usually the
                  children of a mediaobject or inlinemediaobject) and determines
                  the "right" object. It returns the position of that object
                  to be used by the calling template.
               </p>
               
               
               
               
               <p>If the parameter <i class="parameter"><tt>use.role.for.mediaobject</tt></i>
                  is nonzero, then it first checks for an object with
                  a role attribute of the appropriate value.  It takes the first
                  of those.  Otherwise, it takes the first acceptable object
                  through a recursive pass through the list.
               </p>
               
               
               
               
               <p>This template relies on a template named "is.acceptable.mediaobject"
                  to determine if a given object is an acceptable graphic. The semantics
                  of media objects is that the first acceptable graphic should be used.
                  
               </p>
               
               
               
               
               <p>If no acceptable object is located, no index is returned.</p>
               
               
            </div>
            <div class="refparameter"><b><a name="d0e227"></a>Parameters</b>
               
               
               <div class="variablelist">
                  <dl>
                     <dt><span class="term">olist</span></dt>
                     <dd>
                        <p>The node list of potential objects to examine.</p>
                     </dd>
                     <dt><span class="term">count</span></dt>
                     <dd>
                        <p>The position in the list currently being considered by the 
                           recursive process.
                        </p>
                     </dd>
                  </dl>
               </div>
               
               
            </div>
            <div class="refreturn"><b><a name="d0e243"></a>Returns</b>
               
               
               <p>Returns the position in the original list of the selected object.</p>
               
               
            </div>
         </div>
         <div class="refentry" lang="en">
            <div class="refentry.separator">
               <hr>
            </div><a name="template.is.acceptable.mediaobject"></a><div class="titlepage">
               <div></div>
               <div></div>
            </div>
            <div class="refnamediv">
               <h2></h2>
               <p>is.acceptable.mediaobject &#8212; Returns '1' if the specified media object is recognized.</p>
            </div>
            <div class="refsynopsisdiv">
               <h2></h2><pre class="synopsis">&lt;xsl:template name="is.acceptable.mediaobject"&gt;
&lt;xsl:param name="object"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
            <div class="refdescription"><a name="d0e257"></a>
               
               
               <p>This template examines a media object and returns '1' if the
                  object is recognized as a graphic.
               </p>
               
               
            </div>
            <div class="refparameter"><b><a name="d0e262"></a>Parameters</b>
               
               
               <div class="variablelist">
                  <dl>
                     <dt><span class="term">object</span></dt>
                     <dd>
                        <p>The media object to consider.</p>
                     </dd>
                  </dl>
               </div>
               
               
            </div>
            <div class="refreturn"><b><a name="d0e272"></a>Returns</b>
               
               
               <p>0 or 1</p>
               
               
            </div>
         </div>
         <div class="refentry" lang="en">
            <div class="refentry.separator">
               <hr>
            </div><a name="template.check.id.unique"></a><div class="titlepage">
               <div></div>
               <div></div>
            </div>
            <div class="refnamediv">
               <h2></h2>
               <p>check.id.unique &#8212; Warn users about references to non-unique IDs</p>
            </div>
            <div class="refsynopsisdiv">
               <h2></h2><pre class="synopsis">&lt;xsl:template name="check.id.unique"&gt;
&lt;xsl:param name="linkend"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
            <div class="refdescription"><a name="d0e286"></a>
               
               
               <p>If passed an ID in <tt class="varname">linkend</tt>,
                  <tt class="function">check.id.unique</tt> prints
                  a warning message to the user if either the ID does not exist or
                  the ID is not unique.
               </p>
               
               
            </div>
         </div>
         <div class="refentry" lang="en">
            <div class="refentry.separator">
               <hr>
            </div><a name="template.check.idref.targets"></a><div class="titlepage">
               <div></div>
               <div></div>
            </div>
            <div class="refnamediv">
               <h2></h2>
               <p>check.idref.targets &#8212; Warn users about incorrectly typed references</p>
            </div>
            <div class="refsynopsisdiv">
               <h2></h2><pre class="synopsis">&lt;xsl:template name="check.idref.targets"&gt;
&lt;xsl:param name="linkend"/&gt;
&lt;xsl:param name="element-list"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
            <div class="refdescription"><a name="d0e306"></a>
               
               
               <p>If passed an ID in <tt class="varname">linkend</tt>,
                  <tt class="function">check.idref.targets</tt> makes sure that the element
                  pointed to by the link is one of the elements listed in
                  <tt class="varname">element-list</tt> and warns the user otherwise.
               </p>
               
               
            </div>
         </div>
         <div class="refentry" lang="en">
            <div class="refentry.separator">
               <hr>
            </div><a name="template.copyright.years"></a><div class="titlepage">
               <div></div>
               <div></div>
            </div>
            <div class="refnamediv">
               <h2></h2>
               <p>copyright.years &#8212; Print a set of years with collapsed ranges</p>
            </div>
            <div class="refsynopsisdiv">
               <h2></h2><pre class="synopsis">&lt;xsl:template name="copyright.years"&gt;
&lt;xsl:param name="years"/&gt;
&lt;xsl:param name="print.ranges" select="1"/&gt;
&lt;xsl:param name="single.year.ranges" select="0"/&gt;
&lt;xsl:param name="firstyear" select="0"/&gt;
&lt;xsl:param name="nextyear" select="0"/&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
            <div class="refdescription"><a name="d0e329"></a>
               
               
               <p>This template prints a list of year elements with consecutive
                  years printed as a range. In other words:
               </p>
               
               
               <pre class="screen">&lt;year&gt;1992&lt;/year&gt;
&lt;year&gt;1993&lt;/year&gt;
&lt;year&gt;1994&lt;/year&gt;</pre>
               
               
               <p>is printed <span class="quote">1992-1994</span>, whereas:
               </p>
               
               
               <pre class="screen">&lt;year&gt;1992&lt;/year&gt;
&lt;year&gt;1994&lt;/year&gt;</pre>
               
               
               <p>is printed <span class="quote">1992, 1994</span>.
               </p>
               
               
               
               
               <p>This template assumes that all the year elements contain only
                  decimal year numbers, that the elements are sorted in increasing
                  numerical order, that there are no duplicates, and that all the years
                  are expressed in full <span class="quote">century+year</span>
                  (<span class="quote">1999</span> not <span class="quote">99</span>) notation.
               </p>
               
               
            </div>
            <div class="refparameter"><b><a name="d0e364"></a>Parameters</b>
               
               
               <div class="variablelist">
                  <dl>
                     <dt><span class="term">years</span></dt>
                     <dd>
                        <p>The initial set of year elements.</p>
                     </dd>
                     <dt><span class="term">print.ranges</span></dt>
                     <dd>
                        <p>If non-zero, multi-year ranges are collapsed. If zero, all years
                           are printed discretely.
                        </p>
                     </dd>
                     <dt><span class="term">single.year.ranges</span></dt>
                     <dd>
                        <p>If non-zero, two consecutive years will be printed as a range,
                           otherwise, they will be printed discretely. In other words, a single
                           year range is <span class="quote">1991-1992</span> but discretely it's
                           <span class="quote">1991, 1992</span>.
                        </p>
                     </dd>
                  </dl>
               </div>
               
               
            </div>
            <div class="refreturn"><b><a name="d0e392"></a>Returns</b>
               
               
               <p>This template returns the formatted list of years.</p>
               
               
            </div>
         </div>
         <div class="refentry" lang="en">
            <div class="refentry.separator">
               <hr>
            </div><a name="template.find.path.params"></a><div class="titlepage">
               <div></div>
               <div></div>
            </div>
            <div class="refnamediv">
               <h2></h2>
               <p>find.path.params &#8212; Search in a table for the "best" match for the node</p>
            </div>
            <div class="refsynopsisdiv">
               <h2></h2><pre class="synopsis">&lt;xsl:template name="find.path.params"&gt;
&lt;xsl:param name="node" select="."/&gt;
&lt;xsl:param name="table" select="''"/&gt;
&lt;xsl:param name="location"&gt;
    &lt;xsl:call-template name="xpath.location"&gt;
      &lt;xsl:with-param name="node" select="$node"/&gt;
    &lt;/xsl:call-template&gt;
  &lt;/xsl:param&gt;
  ...
&lt;/xsl:template&gt;</pre></div>
            <div class="refdescription"><a name="d0e406"></a>
               
               
               <p>This template searches in a table for the value that most-closely
                  (in the typical best-match sense of XSLT) matches the current (element)
                  node location.
               </p>
               
               
            </div>
         </div>
      </div>
   </body>
</html>